//
//  ReplyModel.m
//  sensen_ios
//
//  Created by boye_mac1 on 16/4/1.
//  Copyright © 2016年 pro. All rights reserved.
//

#import "ReplyModel.h"

@implementation ReplyModel

- (id)initContentWithDic:(NSDictionary *)jsonDic {
    self = [super init];
    if (self != nil) {
        [self setAttributes:jsonDic];
        _replyId = jsonDic[@"id"];
        //头像
        NSDictionary *userInfoDic= jsonDic[@"user_info"];
        if (![userInfoDic[@"nickname"] isKindOfClass:[NSNull class]]) {
            _nickname = userInfoDic[@"nickname"];
            if (_nickname.length == 0) {
                _nickname = _author;
            }
        }else{
            _nickname = _author;
        }
        
        id grDic = userInfoDic[@"group"];
        if (![grDic isKindOfClass:[NSNull class]]) {
            _isAllowpost = grDic[@"allowpost"];
        }
        if (_isAllowpost == nil) {
            _isAllowpost = @"1";
        }
        NSString *head = userInfoDic[@"head"];
        if ([head checkPositiveInteger]) {
            _authorImage = [NSString stringWithFormat:@"%@%@",BOYE_PICTURE_URL,head];
        }else{
            _authorImage = head;
        }
    }
    return self;
}
@end
